<template>
  <div class="error-container">
    <div class="error-content">
      <div class="error-icon">
        <el-icon :size="120">
          <Warning />
        </el-icon>
      </div>
      
      <h1 class="error-title">404</h1>
      <p class="error-message">页面走丢了...</p>
      <p class="error-description">您访问的页面不存在，可能已被删除或移动</p>
      
      <div class="error-actions">
        <el-button type="primary" @click="goHome">
          返回首页
        </el-button>
        <el-button @click="goBack">
          返回上页
        </el-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { Warning } from '@element-plus/icons-vue'

const router = useRouter()

const goHome = () => {
  router.push('/')
}

const goBack = () => {
  if (window.history.length > 1) {
    router.go(-1)
  } else {
    router.push('/')
  }
}
</script>

<style lang="scss" scoped>
.error-container {
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 80px 80px;
    animation: float 30s ease-in-out infinite;
  }
}

.error-content {
  text-align: center;
  color: $text-white;
  position: relative;
  z-index: 10;
  
  .error-icon {
    margin-bottom: 24px;
    
    .el-icon {
      opacity: 0.8;
    }
  }
  
  .error-title {
    font-size: 72px;
    font-weight: 900;
    margin: 0 0 16px 0;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  }
  
  .error-message {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
  }
  
  .error-description {
    font-size: 16px;
    opacity: 0.8;
    margin: 0 0 32px 0;
    line-height: 1.5;
  }
  
  .error-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    
    .el-button {
      padding: 12px 24px;
      font-size: 16px;
      border-radius: $border-radius;
    }
  }
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(-1%, -1%) rotate(1deg);
  }
  50% {
    transform: translate(1%, 1%) rotate(-1deg);
  }
  75% {
    transform: translate(-1%, 1%) rotate(1deg);
  }
}

@media (max-width: 480px) {
  .error-content {
    padding: 0 20px;
    
    .error-title {
      font-size: 48px;
    }
    
    .error-message {
      font-size: 20px;
    }
    
    .error-description {
      font-size: 14px;
    }
    
    .error-actions {
      flex-direction: column;
      
      .el-button {
        width: 100%;
      }
    }
  }
}
</style> 